<?php
namespace voxfa\net\core;

class InetAddressSupport {
	
	private $support;
	
	public function getByName($interfaceName){
		return $this->support->selectByName($interfaceName);
	}
	
	public function getByAddress($address){
		return $this->support->selectByAddress($address);
	}
	
	public function removeByName($interfaceName){
		return $this->support->deleteByName($interfaceName);
	}
	
	public function removeByAddress($address){
		return $this->support->deleteByAddress($address);
	}
	
	public function save(InetAddress $address){
		if($this->existByAddress($address->getAddress()))
			throw new InvalidArgumentException("address is already exist!");
		return $this->support->insertAddress($address);
	}
	
	public function existByAddress($address){
		return $this->support->existAddress($address);
	}
	
}